package com.bosicloud.cmb.ibp.microplatform.api;

import com.bosicloud.cmb.ibp.microplatform.commom.constant.UrlDefine;
import com.bosicloud.cmb.ibp.microplatform.commom.model.*;
import com.bosicloud.cmb.ibp.microplatform.commom.vo.*;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@FeignClient(value = "MicroPlatformManagerService", url = "${ibp.service.microplatform-url}")
public interface MicroPlatformManagerClient {


    @PostMapping(UrlDefine.CREATE_MICRO_SERVICE_PLATFORM)
    String createMicroServicePlatform(@RequestBody CreateMicroPlatformVO environmentVO);


    @GetMapping(UrlDefine.SEARCH_ENV_LIST + "/{userId}")
    List<EnvListVO> searchEnvList(@PathVariable(value = "userId") Integer userId);

    @GetMapping(UrlDefine.SEARCH_PLATFORM_COMPONENT_LIST + "/{environmentId}/{envName}")
    IbpPlatformInfo searchPlatformComponentList(@PathVariable(value = "environmentId") Integer environmentId,
                                                @PathVariable(value = "envName") String envName);


    @GetMapping(UrlDefine.CHECK_CLUSTERNAME_ISEXITS + "/{envName}/{clusterName}")
    Boolean checkClusterNameIsExits(@PathVariable(value = "envName") String envName,
                                    @PathVariable(value = "clusterName") String clusterName);


    @GetMapping(value = UrlDefine.SEARCH_CF_NOTIFY_MESSAGE + "/{token}")
    List<IbpCfNotifyMessage> searchCfNotifyMessage(@PathVariable(value = "token") String token);


    @GetMapping(value = UrlDefine.SEARCH_MSPENVIRONMENT + "/{token}")
    IbpMspEnvironment searchMspEnvironmentByToken(@PathVariable(value = "token") String token);


    @PostMapping(value = UrlDefine.DEPLOY_SERVICE)
    String deployService(@RequestBody DeployServiceVO deployServiceVO);


    @GetMapping(value = UrlDefine.SEARCH_CLUSTER_NAME_LIST + "/{userId}/{envName}")
    List<String> searchClusterNameList(@PathVariable(value = "userId") Integer userId,
                                       @PathVariable(value = "envName") String envName);


    @GetMapping(value = UrlDefine.SEARCH_SERVICE_LIST + "/{environmentId}")
    List<ServiceListVO> searchServiceList(@PathVariable(value = "environmentId") Integer environmentId);


    @GetMapping(value = UrlDefine.SEARCH_DEPLOY_SERVICE_INFO + "/{envName}/{clusterName}/{serviceType}/{serviceName}")
    IbpMspDeploy searchDeployServiceInfo(@PathVariable(value = "envName") String envName,
                                         @PathVariable(value = "clusterName") String clusterName,
                                         @PathVariable(value = "serviceType") String serviceType,
                                         @PathVariable(value = "serviceName") String serviceName);


    @GetMapping(value = UrlDefine.SEARCH_MSPENVIRONMENT_INFO + "/{envName}/{clusterName}")
    IbpMspEnvironment searchMspEnvironmentInfo(@PathVariable(value = "envName") String envName,
                                               @PathVariable(value = "clusterName") String clusterName);


    @GetMapping(value = UrlDefine.SEARCH_FAIL_MESSAGE + "/{deployId}/{taskName}")
    IbpApiAwsFailtMsg searchFailMessage(@PathVariable(value = "deployId") Integer deployId,
                                        @PathVariable(value = "taskName") String taskName);


    @PostMapping(value = UrlDefine.ADD_PROJECT_INFO)
    String saveProjectInfo(@RequestBody ProjectInfoVO projectInfoVO);

    @GetMapping(value = UrlDefine.SEARCH_PROJECT_INFO + "/{userId}")
    IbpMspProjectInfo searchProjectInfo(@PathVariable(value = "userId") Integer userId);

}
